//
//  MDHHTTPRequest.m
//  JSTech
//
//  Created by 高得华 on 2019/4/23.
//  Copyright © 2020 华&梅. All rights reserved.
//

#import "MDHHTTPRequest.h"
#import "MDHHTTPService.h"

@interface MDHHTTPRequest ()

/// 请求参数
@property (nonatomic, readwrite, strong) MDHURLParameters * urlParameters;

@end

@implementation MDHHTTPRequest

+ (instancetype)requestWithParameters:(MDHURLParameters *)parameters {
    return [[self alloc] initRequestWithParameters:parameters];
}

- (instancetype)initRequestWithParameters:(MDHURLParameters *)parameters{
    
    self = [super init];
    if (self) {
        self.urlParameters = parameters;
    }
    return self;
}

@end


/// MDHHTTPRequest的分类
@implementation MDHHTTPRequest (MDHHTTPService)

/// 入队
- (RACSignal *)enqueueResultClass:(Class /*subclass of MDHPTModel*/) resultClass {
    return [[MDHHTTPService sharedInstance] enqueueRequest:self resultClass:resultClass];
}

/// 入队 - Model对应的字符串
- (RACSignal *)enqueueResultClassStr:(NSString */*subclass of MDHPTModel*/)resultClass {
    return [self enqueueResultClass:NSClassFromString(resultClass)];
}

@end
